import Vue from "vue";
import App from "./App.vue";
import { initRouter } from "./router";
import "./theme/index.less";
import "@/utils/directive.js";
//ui库
import Antd from "ant-design-vue";
import { message}  from "ant-design-vue";
import { Table, TableColumn, Loading } from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import Viser from "viser-vue";
// if (
//   process.env.VUE_APP_MOCK == "true" &&
//   process.env.NODE_ENV === "development"
// ) {
//   console.log("引用mock");
//   require("@/mock");
// }
// import '@/mock'
import store from "./store";
import "animate.css/source/animate.css";
import Plugins from "@/plugins";
import "@/styles/index.less";
import { initI18n } from "@/utils/i18n";
import bootstrap from "@/bootstrap";
import "moment/locale/zh-cn";
import countTo from 'vue-count-to';
Vue.component("countTo", countTo);

import animated from 'animate.css'
Vue.use(animated)

import * as filters from "./filters"; // 全局filter
// 加载全局过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});

//设置是否异步加载路由
const router = initRouter(store.state.setting.asyncRoutes);
//设置语言环境
const i18n = initI18n("CN", "US");

Vue.use(Antd);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Loading);

Vue.config.productionTip = false;
Vue.use(Viser);
Vue.use(Plugins);

message.config({maxCount:1})
Vue.prototype.$bus = new Vue();

import "viewerjs/dist/viewer.css";
import Viewer from "v-viewer";
Vue.use(Viewer);
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload);

import '@/assets/fonts/iconfont.css';
//使用阿里自定义图标库
// import { Icon } from 'ant-design-vue';
// const MyIcon = Icon.createFromIconfontCN({
//     scriptUrl: require('./assets/icons/iconfont.js'), // 在 iconfont.cn 上生成
// });
// Vue.component('my-icon', MyIcon)

bootstrap({ router, store, i18n, message: Vue.prototype.$message });

export function rewriteLog() {
  console.log = (function(log) {
    return process.env.NODE_ENV == "development" ? log : function() {};
  })(console.log);
}
rewriteLog();

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount("#app");
